//
//  WYShadowButton.m
//  Boss
//
//  Created by admin on 2018/6/11.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYShadowButton.h"
#define kShadowRadius 8
@implementation WYShadowButton
- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self initCommon];
    }
    return self;
}
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
      //  self.userInteractionEnabled = YES;
        [self initCommon];
    }
    return self;
}

- (void)initCommon {
    UIColor *clr = [UIColor hexStringToColor:@"#A7AFC6" alpha:0.2];
    //self.backgroundColor = clr;
    self.layer.shadowColor = clr.CGColor;
    self.layer.cornerRadius = 5;
    self.layer.shadowOffset = CGSizeMake(0,0);
    self.layer.shadowOpacity = 1.0;
    self.layer.shadowRadius = 8;
    //self.layer.shadowPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, self.bounds.size.height/3, self.bounds.size.width, self.bounds.size.height/3*2)].CGPath;
}

- (void)layoutSubviews {
    [super layoutSubviews];
//    self.layer.shadowPath = [UIBezierPath bezierPathWithRect:CGRectMake(8, self.bounds.size.height/2, self.bounds.size.width-(2*8), self.bounds.size.height/2+3)].CGPath;
    self.layer.shadowPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, self.bounds.size.height/3, self.bounds.size.width, self.bounds.size.height/3*2)].CGPath;
    
    
}
@end
